import 'package:flutter_test/flutter_test.dart';
import 'package:pos_link/pos_link.dart';
import 'package:pos_link/pos_link_platform_interface.dart';
import 'package:pos_link/pos_link_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockPosLinkPlatform
    with MockPlatformInterfaceMixin
    implements PosLinkPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<bool> permissionAllowed() {
    // TODO: implement permissionAllowed
    throw UnimplementedError();
  }

  @override
  Future<void> configureFlutterEngine() {
    // TODO: implement configureFlutterEngine
    throw UnimplementedError();
  }
}

void main() {
  final PosLinkPlatform initialPlatform = PosLinkPlatform.instance;

  test('$MethodChannelPosLink is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelPosLink>());
  });

  test('getPlatformVersion', () async {
    PosLink posLinkPlugin = PosLink();
    MockPosLinkPlatform fakePlatform = MockPosLinkPlatform();
    PosLinkPlatform.instance = fakePlatform;

    expect(await posLinkPlugin.getPlatformVersion(), '42');
  });
}
